import java.util.Scanner;

class CreatT {
    class TreeNode {
        char node;
        TreeNode left;
        TreeNode right;

        public TreeNode(char node) {
            this.node = node;
        }
    }

    TreeNode root = null;
    int index = 0;

    public TreeNode creat(String s, char inVal) {
        if (index < s.length() && s.charAt(index) != inVal) {
            root = new TreeNode(s.charAt(index));
            index++;
            root.left = creat(s, inVal);
            index++;
            root.right = creat(s, inVal);
        }
        return root;
    }

    public void inOrder(TreeNode root) {
        if (root != null) {
            inOrder(root.left);
            System.out.println(root);
            inOrder(root.right);
        }
    }
}
public class CreatTree {

    public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
CreatT root  = new CreatT();
root.creat(s,'#');
root.inOrder(root.root);
    }
}
